<?php
session_start();
$link = mysql_connect('192.168.10.40', 'Flavien', 'fla19041994') OR die(mysql_error());
$select = mysql_select_db ('BasePPE_BCB', $link) ;
include ('connexion_base.php');

$id_connexion = connexion();

if ($id_connexion->connect_errno ==0) 
	
{
	
	$Initiation = $_POST['Initiation'];
	$Contemporain = $_POST['Contemporain'];
	$Classique = $_POST['Classique'];
	$Modern = $_POST['Modern'];
	$Hiphop = $_POST['Hiphop'];
	$_SESSION['Initiation'] = $Initiation;
	$_SESSION['Contemporain'] = $Contemporain;
	$_SESSION['Classique']= $Classique;
	$_SESSION['Modern'] = $Modern;
	$_SESSION['Hiphop'] = $Hiphop;
	
	$idId = mysql_query("select * from identification ;");
	$idId = mysql_num_rows($idId);
	$idId=$idId +1;


	$idE =mysql_query("select * from eleve ");
	$idE = mysql_num_rows($idE);
	$idE = $idE +1;
	
	$idR = mysql_query("select * from responsable ");
	$idR = mysql_num_rows($idR);
	$idR = $idR +1;
	
	$idRU = mysql_query("select * from pers_urgence ");
	$idRU = mysql_num_rows($idRU);
	$idRU = $idRU +1;
		
	$sql1="INSERT INTO identification VALUES (
			'".		$idId							."',
			'".		$_SESSION['Identifiant']		."',
			'".		$_SESSION['mdp']				."',
			'".		$_SESSION['mail']				."')";

	
	$sql2= "INSERT INTO eleve VALUES(
			'".		$idE							."',
			'".		$_SESSION['NomE']				."',
			'".		$_SESSION['PrenomE']			."',
			'".		$_SESSION['Date1']				."',
			'		1								  ',
			'".		$idR							."',
			'".		$idRU							."',
			'".		$idId							."')";
	
	$sql3= "INSERT INTO responsable VALUES(
			'".		$idR							."',
			'".		$_SESSION['NomR']				."',
			'".		$_SESSION['Nomtitucheque']		."',
			'".		$_SESSION['PrenomR']			."',
			'".		$_SESSION['adresse']			."',
			'".		$_SESSION['CP']					."',
			'".		$_SESSION['Ville']				."',
			'".		$_SESSION['Telfixe']			."',
			'".		$_SESSION['Telportable']		."',
			'".		$_SESSION['Mail1']				."',
			'		1								  ',
			'		1								')";
	
	$sql4= "INSERT INTO pers_urgence VALUES(
			'".		$idRU							."',
			'".		$_SESSION['NomPAC']				."',
			'".		$_SESSION['PrenomPAC']			."',
			'".		$_SESSION['TelfixePAC']			."',
			'".		$_SESSION['TelportablePAC']		."')";
	

	$result1 =$id_connexion->query($sql1);
	$result2 =$id_connexion->query($sql2);
	$result3 =$id_connexion->query($sql3);
	$result4 =$id_connexion->query($sql4);
	

	if($_SESSION['Initiation'] != 0)
	{
		$sql5 = "Insert into cours_eleve values('".$idE."','".$_SESSION['Initiation']."')";
		@$result5 =$id_connexion->query($sql5);
	}
	
	if($_SESSION['Contemporain'] != 0)
	{
		$sql6 = "Insert into cours_eleve values('".$idE."','".$_SESSION['Contemporain']."')";
		@$result6 =$id_connexion->query($sql6);
	}
	
	if($_SESSION['Classique'] != 0)
	{
		$sql7 = "Insert into cours_eleve values('".$idE."','".$_SESSION['Classique']."')";
		@$result7 =$id_connexion->query($sql7);
	}
	
	if($_SESSION['Modern'] != 0)
	{
		$sql8 = "Insert into cours_eleve values('".$idE."','".$_SESSION['Modern']."')";
		@$result8 =$id_connexion->query($sql8);
	}
	
	if($_SESSION['Hiphop'] != 0)
	{
		$sql9 = "Insert into cours_eleve values('".$idE."','".$_SESSION['Hiphop']."')";
		@$result9 =$id_connexion->query($sql9);
	}
}
header('Location: index.php');
?>